"""
Zip 和 Unzip
- zip 的合并
- unzip 用来分解
"""

first_name_list = ['trond', 'Jack', 'Daniel']
last_name_list = ['dump', 'rose', 'ergou']

first_and_last_name = list(zip(first_name_list, last_name_list))
print(first_and_last_name)

# 不对等的情况
first_name_list = ['trond', 'Jack', 'Daniel', 'Cindy']
last_name_list = ['dump', 'rose', 'ergou']

first_and_last_name = list(zip(first_name_list, last_name_list))
print(first_and_last_name)

# unzip
full_name_list = [
    ('trond', 'dump', 24),
    ('Jack', 'rose', 21),
    ('Daniel', 'ergou', 26),
]

first_name, last_name, age = list(zip(*full_name_list))
print(f"first name:{first_name},last name:{last_name},age:{age}")
